test: cover the menu state machine and more helpers - #8
Merged
Conversation
Add 10 criterion tests: - test_menu: exercises the menu transitions (push/pop/set_tab) and every predicate (overworld, hud, pause, pause tabs, settings tabs, win/lose), locking in that the named helpers behave like the old decimal arithmetic. - test_str_more: my_strcat, my_strndup, my_str_to_word_array, and my_put_nbr / my_float (captured through a temp fd) across the full int range. Suite is now 20 tests, all passing under `make tests_run` and `make tests_asan` (no ASan/UBSan findings).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The criterion suite covered the early fixes but not the menu refactor or
several helpers. More coverage = the behaviour we just locked in can't silently
regress.
What
menu_push/menu_pop/menu_set_tab) and everypredicate (
menu_in_overworld,menu_show_hud,menu_pause_open,menu_pause_active, pause/settings tabs,menu_won/menu_lost). This pins thenamed menu helpers to the exact values the old decimal arithmetic produced.
my_strcat,my_strndup,my_str_to_word_array, andmy_put_nbr/my_float(captured through a temp fd) acrossINT_MIN..INT_MAX.Verification
make tests_run→Tested: 20 | Passing: 20 | Failing: 0.make tests_asan→ 20/20, no AddressSanitizer / UBSan findings.